<template>
  <!-- 添加或修改盘点计划对话框 -->
  <el-dialog :title="title" v-if="open" v-model="open" width="900px" append-to-body>
    <div v-loading="loading">
      <el-table border :data="dataSource">
        <el-table-column type="index" width="55" align="center" />
        <el-table-column label="移交日期" align="center" min-width="120" prop="handoverDate" />
        <el-table-column label="跟单人" align="center" prop="oldFollowUserName" />
        <el-table-column label="被移交人" align="center" prop="newFollowUserName" />
        <el-table-column label="移交原因" align="center" prop="reasonForHandover" />
      </el-table>
    </div>
  </el-dialog>
</template>

<script>
import listMixin from '@/mixins/listMixin';
import followTransfer from '@/api/goods/followTransfer';
import ImagePreview from '@/components/ImagePreview/index.vue';
import { getUserNotPermission } from '@/api/system/user';
import moment from 'moment';
export default {
  name: 'historyForm',
  components: {
    ImagePreview
  },
  mixins: [listMixin],
  data() {
    return {
      open: false,
      title: '跟单历史',
      funcObj: followTransfer,
      dataSource: [],
      loading: false,

      urls: {
        list: '/order/followTransfer/list'
      }
    };
  },
  created() {},
  methods: {
    view(row) {
      this.open = true;
      this.title = '移交历史';
      this.queryParams.clueId = row.id;
      this.queryParams.pageSize = 100;
      this.getList();
    },

    detailAfter() {
      this.dataSource = this.form.jzgClueMaterialVoList;
      this.selectedOptions = this.form.country.split(',');
      this.form.followUserId = this.form.followUserId + '';
      this.assistUserIds = this.form.assistUserId.split(',');
    },
    cancel() {
      this.open = false;
    },

    async customerChange(val) {
      const res = await this.getSupplier(val);
      this.contacts = (res && res.supplierContactList) || [];
      if (this.contacts.length) {
        this.form.contact = this.contacts[0].id;
        this.form.contactWay = this.contacts[0].phone;
        this.form.postName = this.contacts[0].postName;
      }
      this.form.addDetail = res.addDetail;
      this.form.country = res.saleArea;
    },
    contactChange(val) {
      const index = this.contacts.findIndex((item) => item.name === val);
      if (index !== -1) {
        this.form.contactWay = this.contacts[index].phone;
      }
    },
    // 后台用户
    getUserNotPermission() {
      getUserNotPermission()
        .then((res) => {
          this.assistList = res;
        })
        .catch((err) => {
          console.log(err);
        });
    }
  }
};
</script>

<style lang="scss" scoped></style>